package com.lukstron.youko;

import java.util.ArrayList;
import java.util.List;

public class Wenner extends Method implements IMethod {

	public Wenner(int electrode) {
		super(electrode);
	}

	public Integer getNadir() {
		return (this.electrode - 1) / 3;
	}

	public Integer count() {
		return this.count(this.getNadir());
	}

	public Integer count(int limit) {
		int total = 0;
		for (int i = 1; i <= limit; i++) {
			total += this.electrode - (3 * i);
		}
		return total;
	}

	public List<Datum> getData() {
		return this.getData(this.getNadir());
	}

	public List<Datum> getData(int limit) {
		List<Datum> data = new ArrayList<Datum>();
		int sequence = 0;
		for (int i = 1; i <= limit; i++) {
			int total = this.electrode - (3 * i);
			for (int j = 1; j <= total; j++) {
				Datum datum = new Datum();
				datum.y = i;
				datum.x = j;
				datum.a = j;
				datum.m = datum.a + i;
				datum.n = datum.m + i;
				datum.b = datum.n + i;
				datum.sequence = ++sequence;
				data.add(datum);
			}
		}
		return data;
	}

}
